package com.gofaraway.web.controller;

import com.gofaraway.common.domin.Response;
import com.gofaraway.service.export.service.biz.BaseExcelServiceManage;
import com.gofaraway.service.facade.request.ExportExcelRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author ChenPeng
 * @Date 2024/5/14 17:37
 */
@RestController
@RequestMapping("/excel")
public class ExcelController {

    @Autowired
    private BaseExcelServiceManage baseExcelServiceManage;

    @PostMapping("/export")
    public Response<String> exportAndUploadExcel(@RequestBody @Valid ExportExcelRequest request) {
        String uploadExcel = baseExcelServiceManage.exportAndUploadExcel(request);
        return Response.success(uploadExcel);
    }
}
